#pragma once

#include "Framework/CommonHead.h"
#include "Widgets/WidgetAttribute.h"

#include "WidgetAnchor.m.h"

class RWidget;

RENUM()
enum class EHorizontalWidgetEdge
{
    Left,
    Right,
    Center,
};

RENUM()
enum class EVerticalWidgetEdge
{
    Top,
    Bottom,
    Center,
};


RSTRUCT(ExtraHeader=["Widgets/Widget.h"])
struct WHENGINE_API SWidgetAnchor 
{
    ROBJECT
public:

    RFUNCTION()
    void Fill(TSharedObjectPtr<RWidget> InWidget);

    RFUNCTION()
    void HorizontalFill(TSharedObjectPtr<RWidget> InWidget);
    
    RFUNCTION()
    void VerticalFill(TSharedObjectPtr<RWidget> InWidget);
    
    RFUNCTION()
    void CenterIn(TSharedObjectPtr<RWidget> InWidget);

    RFUNCTION()
    void Clear();

    RFIELD()
    TWidgetAttribute<TSharedObjectPtr<RWidget>> LeftReference;
    RFIELD()
    TWidgetAttribute<EHorizontalWidgetEdge> LeftReferenceEdge=EHorizontalWidgetEdge::Left;
    RFIELD()
    TWidgetAttribute<float> LeftOffset=0;

    RFIELD()
    TWidgetAttribute<TSharedObjectPtr<RWidget>> RightReference;
    RFIELD()
    TWidgetAttribute<EHorizontalWidgetEdge> RightReferenceEdge=EHorizontalWidgetEdge::Right;
    RFIELD()
    TWidgetAttribute<float> RightOffset=0;

    RFIELD()
    TWidgetAttribute<TSharedObjectPtr<RWidget>> HorizontalCenterReference;
    RFIELD()
    TWidgetAttribute<EHorizontalWidgetEdge> HorizontalCenterReferenceEdge=EHorizontalWidgetEdge::Center;
    RFIELD()
    TWidgetAttribute<float> HorizontalCenterOffset=0;

    RFIELD()
    TWidgetAttribute<TSharedObjectPtr<RWidget>> TopReference;
    RFIELD()
    TWidgetAttribute<EVerticalWidgetEdge> TopReferenceEdge=EVerticalWidgetEdge::Top;
    RFIELD()
    TWidgetAttribute<float> TopOffset=0;

    RFIELD()
    TWidgetAttribute<TSharedObjectPtr<RWidget>> BottomReference;
    RFIELD()
    TWidgetAttribute<EVerticalWidgetEdge> BottomReferenceEdge=EVerticalWidgetEdge::Bottom;
    RFIELD()
    TWidgetAttribute<float> BottomOffset=0;

    RFIELD()
    TWidgetAttribute<TSharedObjectPtr<RWidget>> VerticalCenterReference;
    RFIELD()
    TWidgetAttribute<EVerticalWidgetEdge> VerticalCenterReferenceEdge=EVerticalWidgetEdge::Center;
    RFIELD()
    TWidgetAttribute<float> VerticalCenterOffset=0;
};